package com.example;

import com.example.shiro.mapper.util.MyMapper;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.io.File;

@EnableCaching
@SpringBootApplication
@EnableSwagger2
@MapperScan(basePackages = "com.example.shiro.mapper",markerInterface = MyMapper.class)
public class ShiroApplication {

	public static void main(String[] args) {
		SpringApplication.run(ShiroApplication.class, args);
	}

	@Bean
	public EmbeddedServletContainerFactory embeddedServletContainerFactory() {
		ConfigurableEmbeddedServletContainer factory = new TomcatEmbeddedServletContainerFactory();
		factory.setDocumentRoot(new File("I:\\shiro\\src\\main\\webapp"));
		return (EmbeddedServletContainerFactory) factory;
	}
}
